package com.slipper.bpmn.parser.support;

import com.slipper.bpmn.parser.IParser;
import org.dom4j.Element;

import com.slipper.bpmn.model.StartNode;

public class StartNodeParser implements IParser<StartNode> {
    @Override
    public StartNode parser(Element element) {
        StartNode startNode = parser(new StartNode(), element);
        if (!startNode.getInLine().isEmpty()) {
            throw new RuntimeException("开始节点不允许有流入线！");
        }
        if (startNode.getOutLine().size() != 1) {
            throw new RuntimeException("开始节点必须有且仅有一条流出线！");
        }
        return startNode;
    }
}
